import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/home/Home'
import User from '../views/user/User'
import Work from '../views/work/Work'
import Echarts from '../views/echarts/Echarts'
import Layout from '../layout/Layout'
import Login from '../views/Login'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        redirect: 'layout'
    },
    {
        path: '/layout',
        name: 'layout',
        component: Layout,
        children: [{
                path: 'home',
                name: 'home',
                component: Home
            },
            {
                path: 'user',
                name: 'user',
                component: User
            },
            {
                path: 'work',
                name: 'work',
                component: Work
            },
            {
                path: 'echarts',
                name: 'echarts',
                component: Echarts
            }
        ]
    },
    {
        path: '/login',
        name: 'login',
        component: Login
    }
]

const router = new VueRouter({
    routes
})

export default router